
<%-------------------------------------------------------------------
 * 页面名称：/page/myspace/transactionHisQueryPage.jsp
 * 功能描述：对帐单打印
 * Action: cn.agiledata.bank.myspace.action.PrintTransactionHisAction
 *
 *-------------------------------------------------------------------
--%>
<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-tiles.tld" prefix="tiles"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-bean.tld" prefix="bean"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="ipb" uri="/WEB-INF/conf/tld/ipb.tld"%>
<%@ taglib prefix="ad" uri="agiledata"%>
<%@ page import="cn.agiledata.bank.common.util.Constant"%>
<%@ page import="cn.agiledata.bank.account.service.IAccountConst"%>
<%@ page import="cn.agiledata.bank.account.service.AccountSummary"%>
<%
	String path = request.getContextPath();
	AccountSummary user = (AccountSummary) session
			.getAttribute(Constant.SESSION_ACCOUNT_SUMMARY);
%>
<script type="text/javascript">
<!--
function doSearch(){
    var selYear = document.forms["0"].selectYear;
    var selMonth = document.forms["0"].selectMonth;

    if(selYear.value==0){
    alert("请选择年份");
    return;
    }
    if(selMonth.value==0){
    alert("请选择月份");
    return;
    }
    document.forms["0"].action="<%=path%>/page/myspace/toQueryPage.do";
    document.forms["0"].submit();
    
}
function doExport(){
    var selYear = document.forms["0"].selectYear;
    var selMonth = document.forms["0"].selectMonth;

    if(selYear.value==0){
    alert("请选择年份");
    return;
    }
    if(selMonth.value==0){
    alert("请选择月份");
    return;
    }
    document.forms["0"].action="<%=path%>/page/myspace/exportTransHis.action";
    document.forms["0"].submit();
    
}
//-->

    function printPaper(subAccountID,startPage,beginDate,endDate,pageSize,page,printPageSize) {
        var url = "<%=path%>/page/myspace/PrintTransactionHisPage.do?subAccountID="+subAccountID+"&startPage="+startPage+"&beginDate="+beginDate+"&endDate="+endDate+"&pageSize="+pageSize+"&page="+page+"&printPagesize="+printPageSize;
        window.open(url,'','left=100,top=200,width=1000,height=600,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes');
    }
    
    function confirmPrint() {
        var s = "您是否做了页面提示上所述的设置？选择[确定]进入打印，选择[取消]进行设置";
        if(!confirm(s)) return false;
        else return true;
    }
//////////////////

function DateSelector(selYear, selMonth)
{
    this.selYear = selYear;
    this.selMonth = selMonth;
   
    this.InitYearSelect();
    this.InitMonthSelect();
}

// 增加一个最小年份的属性
DateSelector.prototype.MinYear = (new Date()).getFullYear() - 1;

// 增加一个最大年份的属性
DateSelector.prototype.MaxYear = (new Date()).getFullYear();

// 初始化年份
DateSelector.prototype.InitYearSelect = function()
{
    // 循环添加OPION元素到年份select对象中
    for(var i = this.MaxYear; i >= this.MinYear; i--)
    {
        // 新建一个OPTION对象
        var op = window.document.createElement("OPTION");
       
        // 设置OPTION对象的值
        op.value = i;
       
        // 设置OPTION对象的内容
        op.innerHTML = i + "年";
       
        // 添加到年份select对象
        this.selYear.appendChild(op);
    }
}

// 初始化月份
DateSelector.prototype.InitMonthSelect = function()
{
    // 循环添加OPION元素到月份select对象中
    for(var i = 1; i < 13; i++)
    {
        // 新建一个OPTION对象
        var op = window.document.createElement("OPTION");
       if(i<10){
        // 设置OPTION对象的值
        op.value = "0"+i;
        }else{
         op.value =i;
        }
       
        // 设置OPTION对象的内容
        op.innerHTML = i + "月";
       
        // 添加到月份select对象
        this.selMonth.appendChild(op);
    }
}
</script>
<div id="main">
	<html:form action="toQueryPage.do">
		<html:hidden property="pageNo" />
		<div class="content_right">
			<div style="width:745px;margin-left:10px;">
				<div class="titleinfo">
					交易查询
				</div>
				<div class="edit_pass">
					<table width="100%" border="0" align="center" cellpadding="5"
						cellspacing="1">
						<tr>
							<td bgcolor="#FFFFFF" colspan="3"></td>
						</tr>
						<tr>
							<td>
								<div class="select">
									<div>
										<select name="selectYear">
											<option value="0">
												请选择要打印的年份
											</option>
										</select>
							</td>
							<td>
								<div class="select">
									<div>
										<select name="selectMonth">
											<option value="0">
												请选择要打印的月份
											</option>
										</select>
							</td>
							<td>
								<input type="button" value="查 询" class="graybutton_stylelong"
									onclick="doSearch()" />
								&nbsp;&nbsp;&nbsp;&nbsp;
								<input type="button" value="下载到XLS列表"
									class="graybutton_stylelong" onclick="doExport();" />
							</td>
						</tr>
						<tr>
							<td colspan="5" bgcolor="#FFFFFF" class="orang16b">
								<hr size="1" style="color:#88A7C0;" />
							</td>
						</tr>
						<logic:empty name="list">
							<tr>
								<td colspan="5" bgcolor="#FFFFFF" align="center">
									<span class="button_Frame">当前月份没有数据</span>
								</td>
							</tr>
						</logic:empty>
						<logic:notEmpty name="list">
							<tr>
								<td colspan="5" bgcolor="#FFFFFF">
									以下是你<bean:write
												name="year" />年<bean:write name="month" />月要打印的数据
								</td>
							</tr>
							<tr>
								<td colspan="5" bgcolor="#FFFFFF">
									<logic:iterate id="pagecount" name="list" indexId="i">
										<input type="button" class="graybutton_stylelong"
											value="对账单第<%=i.intValue() + 1%>页"
											onclick="if(confirmPrint()) printPaper('<bean:write name="pagecount" property="subAccountId"/>','<bean:write name="pagecount" property="nowPage"/>','<bean:write name="beginDate"/>','<bean:write name="endDate"/>','<bean:write name="pageSize"/>','<%=i.intValue() + 1%>','<%=Constant.PRINTPAGESIZE%>')" />
          &nbsp;&nbsp;&nbsp;&nbsp; 
          <%
           if ((i.intValue() + 1) % 9 == 0) {
           %>
										<br />
										<%
										}
										%>
									</logic:iterate>
								</td>
							</tr>
							<br />
							<table width="100%" border="0" align="center" cellpadding="7"
								cellspacing="1" bgcolor="#f9e277" style="margin:10px 0;">
								<tr>
									<td bgcolor="#fffdf5">
										<table width="100%" border="0" cellpadding="3" cellspacing="0">
											<tr>
												<td width="3%" height="25" valign="top"
													style="border-bottom:1px solid #ccc;"></td>
												<td width="97%" align="left" class="red12b"
													style="border-bottom:1px solid #ccc;">
													如果需要打印对账单，为了保证打印的效果，请做如下的设置：
												</td>
											</tr>
											<tr>
												<td valign="top">
													&nbsp;
												</td>
												<td align="left" class="text9green">
													&nbsp;
												</td>
											</tr>
											<tr>
												<td height="25" valign="top">
													&nbsp;
												</td>
												<td align="left" class="font_gray">
													1)
													选择IE浏览器中的&quot;工具&quot;--&gt;&quot;Internet选项&quot;--&gt;&quot;高级&quot;中的&quot;打印&quot;--&gt;&quot;打印背景颜色和图像&quot;
												</td>
											</tr>
											<tr>
												<td height="25" valign="top">
													&nbsp;
												</td>
												<td align="left" class="font_gray">
													2)
													选择IE浏览器中的&quot;文件&quot;--&gt;&quot;页面设置&quot;--&gt;把&quot;页眉&quot;和&quot;页脚&quot;的内容清空
												</td>
											</tr>
											<tr>
												<td height="25" valign="top">
													&nbsp;
												</td>
												<td align="left" class="font_gray">
													3)
													在打印页面中选择&quot;常规&quot;--&gt;&quot;首选项&quot;--&gt;把布局方式改为'横向'
												</td>
											</tr>
										</table>
									</td>
								</tr>
							</table>
						</logic:notEmpty>
					</table>
				</div>
			</div>
		</div>
	</html:form>
</div>
<script>
    var selYear = document.forms["0"].selectYear;
    var selMonth = document.forms["0"].selectMonth;

    // 新建一个DateSelector类的实例，将个select对象传进去
    new DateSelector(selYear,selMonth);
    
    <logic:notEmpty name="list">
    // 设置年月的选中值
    selYear.value='<bean:write name="year"/>';
    selMonth.value='<bean:write name="month"/>';
    </logic:notEmpty>
</script>
